/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package bynightBusinessLogic;

import bynightClasses.Locale;
import javax.ejb.Stateless;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import java.util.List;
/**
 *
 * @author Giuseppe
 */
@Stateless
public class LocaleFacade extends AbstractFacade<Locale> {
    @PersistenceContext(unitName = "byNightProject-ejbPU")
    private EntityManager em;

    protected EntityManager getEntityManager() {
        return em;
    }

    public LocaleFacade() {
        super(Locale.class);
    }

    public List<Locale> search(String name) {
        List<Locale> res= null;
        try{
            res = em.createNamedQuery("Locale.findByName").setParameter("nome", name).getResultList();
        }
        catch(Exception e)
        {
            
        }
        return res;
    }
    
}
